package com.biz.primus.app.erpbridge.controller;

import com.biz.primus.app.erpbridge.feign.PriceFeignClient;
import com.biz.primus.base.support.rest.vo.JsonResult;
import com.biz.primus.model.price.vo.SyncPriceVo;
import com.biz.primus.model.price.vo.SyncSpecPriceVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author jiangnan
 * @Description:
 */
@RestController
@RequestMapping("bridge/price")
public class PriceBridgeController extends BaseBridgeController {

    private final PriceFeignClient priceFeignClient;

    public PriceBridgeController(PriceFeignClient priceFeignClient) {
        this.priceFeignClient = priceFeignClient;
    }

    @ApiOperation("同步价格主数据")
    @PostMapping("syncPrices")
    JsonResult syncPrices(@RequestBody List<SyncPriceVo> reqVos){
        this.priceFeignClient.syncPrices(reqVos);
        return new JsonResult();
    }

    @ApiOperation("同步多规格价格主数据")
    @PostMapping("syncSpecPrices")
    JsonResult syncSpecPrices(@RequestBody List<SyncSpecPriceVo> reqVos){
        this.priceFeignClient.syncSpecPrices(reqVos);
        return new JsonResult();
    }

}
